package com.hrms.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.hrms.dao.DepartmentDao;
import com.hrms.pojo.Department;
import com.hrms.pojo.Employee;
import com.hrms.service.DepartmentService;

@Service("departmentService")
public class DepartmentServiceImpl implements DepartmentService {

	@Resource
	private DepartmentDao departmentDao;

	@Override // 查找所有部门
	public List<Department> getDepartALL() {
		return departmentDao.selectDepartAll();
	}

	@Override // 根据部门id查找员工
	public List<Employee> getByIdWithEmp(int dtId) {
		return departmentDao.selectByIdWithEmp(dtId);
	}

	@Override // 根据id查找部门
	public Department getDepartById(int dtId) {
		return departmentDao.selectDepartById(dtId);
	}

	@Override // 添加部门
	public int addDepart(Department depart) {
		return departmentDao.insertDepart(depart);
	}

	@Override // 修改部门
	public int alterDepart(Department depart) {
		return departmentDao.updateDepart(depart);
	}

	@Override // 根据id删除部门
	public int removeDepart(int dtId) {
		return departmentDao.deleteDepart(dtId);
	}

	@Override// 根据名称查找部门
	public Department getByName(String dtName) {
		return departmentDao.selectByName(dtName);
	}

}
